package cn.zymall.common.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 定时任务表
 */
@Data
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "sys_task")
public class SysTask extends BaseEntity implements Serializable {
    public static final String COL_SPU_TASK_TIME = "SPU_TASK_TIME";
    public static final String COL_SPU_TASK_STATUS = "SPU_TASK_STATUS";
    public static final String COL_SPU_TASK_TYPE = "SPU_TASK_TYPE";
    /**
     * 任务编号
     */
    @TableId(value = "TASK_ID", type = IdType.AUTO)
    private Integer taskId;

    /**
     * 任务名称
     */
    @TableField(value = "TASK_NAME")
    private String taskName;

    /**
     * 任务SQL
     */
    @TableField(value = "TASK_SQL")
    private String taskSql;

    /**
     * 任务开始时间
     */
    @TableField(value = "TASK_TIME")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",
            timezone = "GMT+8")
    private Date taskTime;

    /**
     * 0是未处理，1是已处理，-1是处理失败
     */
    @TableField(value = "TASK_STATUS")
    private Integer taskStatus;

    /**
     * -1暂停使用，0单次任务，1循环任务
     */
    @TableField(value = "TASK_TYPE")
    private Integer taskType;

    /**
     * 创建人
     */
    @TableField(value = "CREATE_BY")
    private Integer createBy;

    /**
     * 创建时间
     */
    @TableField(value = "CREATE_TIME")
    private Date createTime;

    /**
     * 更新人
     */
    @TableField(value = "UPDATE_BY")
    private Integer updateBy;

    /**
     * 更新时间
     */
    @TableField(value = "UPDATE_TIME")
    private Date updateTime;

    /**
     * 作用与前端传值，与表无关联
     */
    @TableField(exist = false)
    private String dateTime;


    private static final long serialVersionUID = 1L;

    public static final String COL_TASK_ID = "TASK_ID";

    public static final String COL_TASK_NAME = "TASK_NAME";

    public static final String COL_TASK_SQL = "TASK_SQL";

    public static final String COL_TASK_TIME = "TASK_TIME";

    public static final String COL_TASK_STATUS = "TASK_STATUS";

    public static final String COL_TASK_TYPE = "TASK_TYPE";

    public static final String COL_CREATE_BY = "CREATE_BY";

    public static final String COL_CREATE_TIME = "CREATE_TIME";

    public static final String COL_UPDATE_BY = "UPDATE_BY";

    public static final String COL_UPDATE_TIME = "UPDATE_TIME";
}
